<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>团课签到</title>
	<meta content="width=device-width,initial-scale=1.0,minimum-scale=1.0.maximum-scale=1.0,user-scalable=no" name="viewport">
	<link rel="stylesheet" href="css/weui.min.css">
	<link rel="stylesheet" href="css/jquery-weui.css">
	<link rel="stylesheet" href="css/swiper.min.css">
	<link rel="stylesheet" href="css/reset.css">
	<link rel="stylesheet" href="css/bosscoach.css">
	<link rel="stylesheet" href="css/flexible.css">
	<link rel="stylesheet" href="css/vant.css">
	<script src="js/vue/vue.js"></script>
	<script src="js/vue/axios.js"></script>
	<script src="js/vue/vant.js"></script>
	<script src="js/jquery.md5.js"></script>
	<script src="js/vue/qs.js"></script>
	<script src="js/glabe.js"></script>
	<script src="js/jquery-3.3.1.min.js"></script>
	<script src="js/fontsize.js"></script>
	<script src="js/comment.js"></script>
	<script src="js/jquery.min.js"></script>
	<script src="js/flexible.js"></script>
	<style>
		.private_Sign_btn{
			padding: 0 0.12rem;
			width: 3.6rem;
			height: 1.25rem;
			line-height: 1.25rem;
			font-size:0.65rem;
			font-family:PingFangSC-Regular;
			font-weight:400;
			color:#0E9CFA;
			text-align: center;
			border-radius: 3px;
			background-color: #fff;
			border:1px solid #0E9CFA;
		}
		.private_Sign_box{
			position: absolute;
			right: 0;
			top: 50%;
			transform: translateY(-50%);
			width: 3.9rem;
		}
		.private_Sign_box>div:nth-child(2){
			margin-top: 0.3rem;
		}
		.isFormality{
			height: auto;
		}
		.isFormality>div{
			width: 3.6rem;
			padding: 0 0.12rem;
			height: 1.25rem;
			font-size: 0.65rem;
			line-height: 1.25rem;
			color: #fff;
			text-align: center;
			border-radius: 3px;
			background-color: #0E9CFA;
		}
		.isFormality>div:nth-child(2){
			margin-top: 0.3rem;
		}
		.addClassBtn{
			width: 0.9rem;
			height: 0.9rem;
		}
		.isFormality>div:nth-child(2){
			background-color: #fff;
			color: #0E9CFA;
			display: flex;
			justify-content: space-around;
			align-items: center;
			padding: 0 0.3rem;
			box-sizing: border-box;
		}
	</style>
</head>
<body>

	<div class="container_box" id="app">
		<template>
			<div class="courseDateDiv clearfix Substitution_header">
					<p class="courseDateShow-span fl" id="courseDateShow"></p>
					<div class="courseDate-icon fr">
						<img src="images/calendar_icon.png" alt="">
						<input class="courseDate-input" id="courseDate_input" inputreadonly="true" readonly="readonly">
					</div>
			</div>
			<div class="courseDate-panel">
				<ul class="course-week clearfix">
					<li>日</li>
					<li>一</li>
					<li>二</li>
					<li>三</li>
					<li>四</li>
					<li>五</li>
					<li>六</li>
				</ul>
				<div class="swiper-container">
					<div class="swiper-wrapper" id="course_date">
						
					</div>
				</div>
			</div>
	
			<div class="Substitution_list Substitution_course">
				<template v-for="(item,indexs) in list">
					<div class="group_details group_details_state paddingtop20 clearfix">
						<div class="clearfix" style="position: relative;">
							<div class="fl" style="width:22%;">
								<img :src="item.picurl ? item.picurl : 'images/moren.png'" alt="" class="spinning_img">
							</div>
							<div class="fl" style="width:78%;">
								<div class="fl" style="margin-left: 0.5rem;">
									<p>
										<span class="spinning_name">{{item.title}}</span>
										<span class="spinning_name">{{item.Sname}}</span>
										<span v-if="item.IsFormality == 1" class="spinning_name" style="color: #0E9CFA;">免预约</span>
									</p>
									<p ><span class="spinning_A">{{item.Space}}</span><span class="spinning_date">{{item.stime}}-{{item.etime}}</span></p>
									<p class="degree">{{item.yyNum}}/{{item.min}} <span v-if="item.IsFormality != 1" class="many_full">预约满{{item.min}}人开课</span><span class="many_full" v-if="item.TemUser > 0">临时学员{{item.TemUser}}人</span></p>
								</div>
								<div v-if="currIndex==indexs" style="position: absolute;top: 50%;transform: translateY(-50%);right: 0;">
									<div v-if="item.IsFormality == 1" class="isFormality">
										<div @click="zkSq(indexs)">收起</div>
										<div @click="addStudents(item)">
											<img class="addClassBtn" src="images/classAddBtn.png" alt="">
											<span>添加</span>
										</div>
									</div>
									<div v-else class="private_Sign fr" @click="zkSq(indexs)">收起</div>
								</div>
								<div v-else class="private_Sign fr" @click="zkSqS(indexs)" style="position: absolute;top: 50%;transform: translateY(-50%);right: 0;">查看</div>
							</div>
						</div>
						<div class="qdClass clearfix" v-if="currIndex==indexs" v-for="items in item.yy_list" style="position: relative;">
							<div class="fl" style="width:22%;">
									<img :src="items.Picurl ? items.Picurl : 'images/moren.png'" alt="" class="spinning_img">
							</div>
							<div class="fl" style="width:78%;" v-if="item.IsFormality != 1">
								<div class="fl" style="margin-left: 0.5rem;">
									<p style="display: flex;align-items:center;">
										<span class="spinning_name">{{items.Username}}</span>
										<img src="images/woman.png"/ v-if="items.Sex == 0" style="width: 0.75rem;height: 0.75rem;margin-left: 0.1rem;">
										<img src="images/man1.png"/ style="width: 0.75rem;height: 0.75rem;margin-left: 0.1rem;" v-else>
									</p>
									<p ><span class="spinning_date">{{items.Cardname}}-剩余{{items.Surplus}}</span></p>
									<p class="degree">{{items.Addtime}}</p>
								</div>
								<template v-if="items.IsReserve == 0">
									<div class="private_Sign_box">
										<div class="private_Sign fr" @click="checkIn(items.id)">签到</div>
										<div class="private_Sign private_Sign1 fr" @click="cancel(items.id)">取消预约</div>
									</div>
								</template>
								<template v-else-if="items.IsReserve == 1">
									<div class="private_Sign private_Sign1 fr" style="position: absolute;top: 50%;right: 0;transform: translateY(-50%);">已签到</div>
								</template>
								<template v-else-if="items.IsReserve == 2">
									<div class="private_Sign private_Sign1 fr" style="position: absolute;top: 50%;right: 0;transform: translateY(-50%);">已取消</div>
								</template>
								<template v-else>
									<div class="private_Sign private_Sign1 fr" style="position: absolute;top: 50%;right: 0;transform: translateY(-50%);">已违约</div>
								</template>
							</div>
							<div v-else class="fl" style="width:78%;">
								<div class="fl" style="margin-left: 0.5rem;">
									<p style="display: flex;align-items:center;">
										<span class="spinning_name">{{items.Username}}</span>
										<img src="images/woman.png"/ v-if="items.Sex == 0" style="width: 0.75rem;height: 0.75rem;margin-left: 0.1rem;">
										<img src="images/man1.png"/ style="width: 0.75rem;height: 0.75rem;margin-left: 0.1rem;" v-else>
									</p>
									<p ><span class="spinning_date">{{items.Cardname}}-剩余{{items.Surplus}}</span></p>
									<p class="degree">{{items.Addtime}}</p>
								</div>
								<template v-if="items.IsReserve == 0">
									<div class="private_Sign_box">
										<div class="private_Sign_btn fr" @click="classCheckIn(items,item)">签到</div>
									</div>
								</template>
								<template v-if="items.IsReserve == 1">
									<div class="private_Sign_box">
										<div class="private_Sign fr private_Sign1">已签到</div>
										<div class="private_Sign fr" @click="classCancel(items.IsReserve_id)">取消</div>
									</div>
								</template>
								<template v-if="items.IsReserve == 2">
									<div class="private_Sign_box">
										<div class="private_Sign_btn fr" @click="classCheckIn(items,item)">签到</div>
									</div>
								</template>
							</div>
						</div>
					</div>
				</template>
			</div>
		</template>
	</div>
	<div style="text-align: center;color:#999999;font-size: 12px;">由馆家提供技术支持</div>
	<script src="js/jquery-weui.js"></script>
	<script src="js/swiper.min.js"></script>
	<script>
	var app = new Vue({
		el: '#app',
		data: {
			//列表数据
			list:null,
			newDate: '',
			currIndex:'0'
		},
		watch: {
			newDate(){
				this.getList();
			},
		},
		methods: {
			getList(){
				//获取列表数据
				axios.get('/mobileapi/boss/curr_sign.php?act=sign_t_list&date='+this.newDate).then(res=>{
					if(res.data.code == 200){
						this.list = res.data.data;
					}else{
						vant.Toast(res.data.msg);
					}
				}).catch(err=>{
					vant.Toast('请求发送失败，请重试')
				})
			},
			//签到
			checkIn(id){
				let from = JSON.stringify({
					id
				});
				let sign = md5(from);
				let obj = {
					from,
					sign
				}
				axios.post('/mobileapi/boss/curr_sign.php?act=YYSign',Qs.stringify(obj)).then(res=>{
					if(res.data.code == 200){
						vant.Toast('签到成功');
						this.getList()
					}else{
						vant.Toast(res.data.msg);
					}
				}).catch(err=>{
					vant.Toast('请求发送失败，请重试')
				})
			},
			//取消预约
			cancel(id){
				let from = JSON.stringify({
					id
				});
				let sign = md5(from);
				let obj = {
					from,
					sign
				}
				axios.post('/mobileapi/boss/curr_sign.php?act=YYCancel',Qs.stringify(obj)).then(res=>{
					if(res.data.code == 200){
						vant.Toast('取消预约成功');
						this.getList()
					}else{
						vant.Toast(res.data.msg);
					}
				}).catch(err=>{
					vant.Toast('请求发送失败，请重试')
				})
			},
			zkSq(index){
				console.log(index)
				this.currIndex='-1'
			},
			zkSqS(index){
				console.log(index)
				this.currIndex=index
			},
			//班级课程添加按钮
			addStudents(obj){
				window.location.href=`addClassStudents.html?plan_id=${obj.plan_id}&key=${obj.key}&date=${obj.date}&currid=${obj.currid}`;
			},
			//班级课程签到
			classCheckIn(obj,obj1){
				let from = JSON.stringify({
					plan_id:obj1.plan_id,
					key:obj1.key,
					date:obj1.date,
					Uidlist:[obj.Uid]
				});
				let sign = md5(from);
				let objs = {
					from,
					sign
				}
				axios.post('/mobileapi/boss/curr.php?act=group_sign_go',Qs.stringify(objs)).then(res=>{
					if(res.data.code == 200){
						vant.Toast('签到成功');
						this.getList()
					}else{
						vant.Toast(res.data.msg);
					}
				}).catch(err=>{
					vant.Toast('请求发送失败，请重试')
				})
			},
			//班级课程取消
			classCancel(id){
				axios.get('/mobileapi/boss/curr.php?act=pass_group_sign_go&id='+id).then(res=>{
					if(res.data.code == 200){
						vant.Toast(res.data.msg);
						this.getList()
					}else{
						vant.Toast(res.data.msg);
					}
				}).catch(err=>{
					vant.Toast('请求发送失败，请重试')
				})
			}
		}
	})
	</script>
	<script src="js/fitnesslist.js"></script>
</body>
</html>